{include file="public/layout" /}

<body>
<link rel="stylesheet" href="__SKIN__/css/page.css" media="all">

<div class="layui-fluid" id="LAY-component-layer-list">
    <div class="layui-card">
        <div class="head-oper">
            <div class="fl">
                <a href="javascript:;" class="layui-btn select">
                    <i class="fa fa-pencil-square-o"></i>确认选择
                </a>
            </div>
        </div>
        <div class="layui-card-body">
            <div class="layui-form layui-border-box layui-table-view house-table"  lay-filter="demo" lay-id="admin-arctype" >
                <div class="layui-table-box">
                    <div class="layui-table-body " >
                        <table cellspacing="0" cellpadding="0" border="0" class="layui-table layui-form" lay-skin="line" style="width: 100%">
                            <thead >
                            <tr>
                                <th class="w40 tc">

                                </th>
                                <th class="w60 tc"> <div class="layui-table-cell w60 tc" ><span>ID</span></div></th>
                                <th class="wauto"> <div class="layui-table-cell wauto"><span>栏目名称</span></div></th>
                            </tr>
                            </thead>
                            <tbody>
                            {empty name="list"}
                            <tr>
                                <td class="no-data" align="center" axis="col0" colspan="9">
                                    <i class="fa fa-exclamation-circle"></i>没有符合条件的数据
                                </td>
                            </tr>
                            {else /}
                            {foreach name="list" item="vo" key="k" }
                            {if condition="($vo.is_hidden eq 0)"}
                            <tr>
                                <td>
                                    <div class="layui-table-cell w40 tc laytable-cell-checkbox">
                                        <input type="checkbox" name="ids[]" value="{$vo.id}" data-title="{$vo.typename}" lay-filter="ids" lay-skin="primary">
                                    </div>
                                </td>
                                <td><div class="layui-table-cell w60 tc"> {$vo.id} </div></td>
                                <td>
                                    <div class="layui-table-cell wauto" title=" ">
                                        {$vo.typename}
                                    </div>
                                </td>
                            </tr>
                            {/if}
                            {/foreach}
                            {/empty}
                            </tbody>
                        </table>
                    </div>
                </div>
                <!--分页-->
            </div>
            <!--{$page}-->
        </div>
    </div>
</div>

<script>
    var aids = '';
    layui.config({
        base: '__SKIN__/' //静态资源所在路径
        ,version: '{$version}'
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;

        // 监听每行复选框
        form.on('checkbox(ids)', function(data){
            if (data.elem.checked && $('input[name*=ids]:checked').length == $('input[name*=ids]').length) {
                $('.checkAll').attr('checked', true);
            } else {
                $('.checkAll').attr('checked', false);
            }
            form.render('checkbox');
        });

    });

    $('.select').on('click',function(){
        var callback = "{$func}";
        var sort = "{$sort}";
        var fileurl_tmp = [];
        var a = [], k = 0, aids = '', titles = '';
        $('input[name*=ids]').each(function(i,o){
            if($(o).is(':checked')){
                a.push($(o).val());
                if (k > 0) {
                    aids += ',';
                    titles += ',';
                }
                aids += $(o).val();
                titles += $(o).data('title');
                k++;
            }
        });
        fileurl_tmp['id'] = aids;
        fileurl_tmp['titles'] = titles;
        fileurl_tmp['sort'] = sort;
        eval('window.parent.'+callback+'(fileurl_tmp)');
        window.parent.layer.closeAll();
    });

</script>
{include file="public/footer" /}
